home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
develop
/
libsrc11.arc
/
MODS.S
< prev
next >
Wrap
Text File
|
1989-04-27
|
1KB
|
51 lines
******************************************************************************
* mods.s 3.1 11/12/84
*
* 68HC11 CROSS C COMPILER RUN-TIME LIBRARY
*
* (c) Copyright 1984, Motorola, Inc.
*
* FUNCTION NAME: .mods
*
* ACTION: Calculate the modulus of two 8-bit signed integers.
*
* REGISTERS AND STACK:
*
* ON ENTRY: X: FP (frame pointer)
* B: Dividend
* A: Divisor
*
* STACK: Return Address
* SP:
*
* ON EXIT: X: FP
* B: Modulus
*
* STACK: Previous Contents
* SP:
*
******************************************************************************
psct
xdef .mods
.mods:
pshx save FP
tsta is divisor > 0?
bpl *+3 yes
nega no..negate
psha copy..
clra ..divisor
psha ..to
pulx ..X
pshb save sign of dividend
tstb is dividend > 0?
bpl *+3 yes
negb no..negate
idiv do division D/X
pula recover sign
tsta is sign positive?
bpl *+3 yes
negb no..negate remainder
pulx restore FP
rts return
end